package surplus;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import myuser.User;
import myuser.UserDao;

public class CheckExistsAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		
		User user=(User)form;
		UserDao dao=new UserDao();
		PrintWriter out=response.getWriter();
		if(dao.checkexists(user)) {
			out.print("1");
		}
		else {
			out.print("0");
		}
		return null;
	}

}
